/*
 *
 * Name        : DateFormated.js
 * Version     : 0.1.0
 * Copyright   : GPL
 * Author      : Hallison Batista
 * Create Date : 2006.02.02
 * Modify Date : 2006.02.03
 * Description : Script useful to format JavaScript Date class values return.
 *
 *               Script ?til para formatar os valores de retorno da classe Data
 *               do Java Script.
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

function dateFormated(delimiterWeekday, delimiterMonthDay, delimiterMonth) {
   var today       = new Date();
   var weekdayText = new Array(7);
   var monthText   = new Array(12);
   var dateText    = new String();

   weekdayText[0] = "Domingo";         // SUN
   weekdayText[1] = "Segunda-Feira";   // MON
   weekdayText[2] = "Ter?a-Feira";     // TUR
   weekdayText[3] = "Quarta-Feira";    // WES
   weekdayText[4] = "Quinta-Feira";    // THU
   weekdayText[5] = "Sexta-Feira";     // FRI
   weekdayText[6] = "S?bado";          // SAT

   monthText[ 0]  = "Janeiro";         // JAN
   monthText[ 1]  = "Fevereiro";       // FEB
   monthText[ 2]  = "Mar?o";           // MAR
   monthText[ 3]  = "Abril";           // APR
   monthText[ 4]  = "Maio";            // MAY
   monthText[ 5]  = "Junho";           // JUN
   monthText[ 6]  = "Julho";           // JUL
   monthText[ 7]  = "Agosto";          // AGO
   monthText[ 8]  = "Setembro";        // SET
   monthText[ 9]  = "Outubro";         // OCT
   monthText[10]  = "Novembro";        // NOV
   monthText[11]  = "Dezembro";        // DEC

   switch (today.getDay()) {
      case 0: { dateText += weekdayText[0]; break; }
      case 1: { dateText += weekdayText[1]; break; }
      case 2: { dateText += weekdayText[2]; break; }
      case 3: { dateText += weekdayText[3]; break; }
      case 4: { dateText += weekdayText[4]; break; }
      case 5: { dateText += weekdayText[5]; break; }
      case 6: { dateText += weekdayText[6]; break; }
      default:{ dateText += today.getDay(); break; }
   }
   dateText += delimiterWeekday;
   dateText += today.getDate();
   dateText += delimiterMonthDay;
   switch (today.getMonth()) {
      case  0: { dateText += monthText[ 0]; break; }
      case  1: { dateText += monthText[ 1]; break; }
      case  2: { dateText += monthText[ 2]; break; }
      case  3: { dateText += monthText[ 3]; break; }
      case  4: { dateText += monthText[ 4]; break; }
      case  5: { dateText += monthText[ 5]; break; }
      case  6: { dateText += monthText[ 6]; break; }
      case  7: { dateText += monthText[ 7]; break; }
      case  8: { dateText += monthText[ 8]; break; }
      case  9: { dateText += monthText[ 9]; break; }
      case 10: { dateText += monthText[10]; break; }
      case 11: { dateText += monthText[11]; break; }
      default: { dateText += today.getMonth(); break; }
   }
   dateText += delimiterMonth;
   dateText += today.getFullYear();
   return dateText;
}
